package com.ruoyi.project.service.impl;

import java.util.Date;
import java.util.List;

import com.ruoyi.common.security.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.mapper.ProjectApplicationMapper;
import com.ruoyi.project.domain.ProjectApplication;
import com.ruoyi.project.service.IProjectApplicationService;

/**
 * 申报项目Service业务层处理
 * 
 * @author czj
 * @date 2025-01-06
 */
@Service
public class ProjectApplicationServiceImpl implements IProjectApplicationService 
{
    @Autowired
    private ProjectApplicationMapper projectApplicationMapper;

    /**
     * 查询申报项目
     * 
     * @param applicationId 申报项目主键
     * @return 申报项目
     */
    @Override
    public ProjectApplication selectProjectApplicationByApplicationId(Long applicationId)
    {
        return projectApplicationMapper.selectProjectApplicationByApplicationId(applicationId);
    }

    /**
     * 查询申报项目列表
     * 
     * @param projectApplication 申报项目
     * @return 申报项目
     */
    @Override
    public List<ProjectApplication> selectProjectApplicationList(ProjectApplication projectApplication)
    {
        return projectApplicationMapper.selectProjectApplicationList(projectApplication);
    }

    /**
     * 新增申报项目
     * 
     * @param projectApplication 申报项目
     * @return 结果
     */
    @Override
    public int insertProjectApplication(ProjectApplication projectApplication)
    {
        projectApplication.setCreatedBy(SecurityUtils.getUsername());
        projectApplication.setCreatedAt(new Date());
        return projectApplicationMapper.insertProjectApplication(projectApplication);
    }

    /**
     * 修改申报项目
     * 
     * @param projectApplication 申报项目
     * @return 结果
     */
    @Override
    public int updateProjectApplication(ProjectApplication projectApplication)
    {
        projectApplication.setUpdatedBy(SecurityUtils.getUsername());
        projectApplication.setUpdatedAt(new Date());
        return projectApplicationMapper.updateProjectApplication(projectApplication);
    }

    /**
     * 批量删除申报项目
     * 
     * @param applicationIds 需要删除的申报项目主键
     * @return 结果
     */
    @Override
    public int deleteProjectApplicationByApplicationIds(Long[] applicationIds)
    {
        return projectApplicationMapper.deleteProjectApplicationByApplicationIds(applicationIds);
    }

    /**
     * 删除申报项目信息
     * 
     * @param applicationId 申报项目主键
     * @return 结果
     */
    @Override
    public int deleteProjectApplicationByApplicationId(Long applicationId)
    {
        return projectApplicationMapper.deleteProjectApplicationByApplicationId(applicationId);
    }
}
